//
//  LRXHistroyHelpItemCell.m
//  路人侠
//
//  Created by zhangxulong on 5/29/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXHistroyHelpItemCell.h"
@interface LRXHistroyHelpItemCell()
@property (weak, nonatomic)  UILabel *itemTimeLabel;

@property (weak, nonatomic)  UILabel *thingCountlabel;

@property (weak, nonatomic)  UIButton *itemDlelebtn;

@end
@implementation LRXHistroyHelpItemCell
- (instancetype)init
{
    self = [super init];
    if (self) {
        UILabel * timeLabel = [[UILabel alloc]init];
        timeLabel.text = @"完成时间：";
        timeLabel.font = [UIFont systemFontOfSize:20 * hScale];
        timeLabel.frame = CGRectMake(45 * wScale, 24 * hScale, 0, 0);
        [timeLabel sizeToFit];
        
        UILabel * itemTimeLabel = [[UILabel alloc]init];
        itemTimeLabel.font = [UIFont systemFontOfSize:20 * hScale];
        itemTimeLabel.frame = CGRectMake(CGRectGetMaxX(timeLabel.frame) + 24 * wScale, 24 * hScale, 200 * wScale, 25 * hScale);
        self.itemTimeLabel = itemTimeLabel;
        
        UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(timeLabel.frame) + 16 * hScale,MainScreenW, 2 * hScale)];
        lineView.backgroundColor = GraylineColor;
        
        UIImageView * imageIcon = [[UIImageView alloc]initWithFrame:CGRectMake(112 * wScale, CGRectGetMaxY(lineView.frame) + 55 * hScale, 90 * hScale, 90 * hScale)];
        imageIcon.layer.cornerRadius = imageIcon.frame.size.width * 0.5;
        imageIcon.layer.masksToBounds = YES;
        self.imageIcon = imageIcon;
        
        UILabel * numStrLabel = [[UILabel alloc]initWithFrame:CGRectMake(298 * wScale, CGRectGetMaxY(lineView.frame) + 41 * hScale, 0, 0)];
        numStrLabel.text = @"数量：";
        numStrLabel.font = [UIFont systemFontOfSize:27 * hScale];
        [numStrLabel sizeToFit];
        
        UILabel * numLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(numStrLabel.frame), numStrLabel.frame.origin.y, 100 * wScale, 27 * hScale)];
        numLabel.font = [UIFont systemFontOfSize:27 * hScale];
        numLabel.textAlignment = NSTextAlignmentRight;
        numLabel.textColor = orangeColor;
        self.thingCountlabel = numLabel;
        
        UILabel * numLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(numLabel.frame) + 10 *wScale, numLabel.frame.origin.y, 0, 0)];
        numLabel2.font = numLabel.font;
        numLabel2.text = @"件";
        [numLabel2 sizeToFit];
        
        UILabel * tipStrLabel = [[UILabel alloc]initWithFrame:CGRectMake(298 * wScale, CGRectGetMaxY(numStrLabel.frame) + 21 * hScale, 0, 0)];
        tipStrLabel.text = @"小费：";
        tipStrLabel.font = [UIFont systemFontOfSize:27 * hScale];
        [tipStrLabel sizeToFit];
        
        UILabel * tipLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(tipStrLabel.frame), tipStrLabel.frame.origin.y, 100 * wScale, 27 * hScale)];
        tipLabel.font = [UIFont systemFontOfSize:27 * hScale];
        tipLabel.textAlignment = NSTextAlignmentRight;
        tipLabel.textColor = orangeColor;
        self.thingTipLabel = tipLabel;
        
        UILabel * tipLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(tipLabel.frame) + 10 *wScale, tipLabel.frame.origin.y, 0, 0)];
        tipLabel2.font = tipLabel.font;
        tipLabel2.text = @"件";
        [tipLabel2 sizeToFit];
        
        UILabel * sumtrLabel = [[UILabel alloc]initWithFrame:CGRectMake(298 * wScale, CGRectGetMaxY(tipStrLabel.frame) + 21 * hScale, 0, 0)];
        sumtrLabel.text = @"合计：";
        sumtrLabel.font = [UIFont systemFontOfSize:27 * hScale];
        [sumtrLabel sizeToFit];
        
        UILabel * sumLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(sumtrLabel.frame), sumtrLabel.frame.origin.y, 100 * wScale, 27 * hScale)];
        sumLabel.font = [UIFont systemFontOfSize:27 * hScale];
        sumLabel.textAlignment = NSTextAlignmentRight;
        sumLabel.textColor = orangeColor;
        self.thingSumlabel = sumLabel;
        
        UILabel * sumLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(sumLabel.frame) + 10 *wScale, sumLabel.frame.origin.y, 0, 0)];
        sumLabel2.font = numLabel.font;
        sumLabel2.text = @"件";
        [sumLabel2 sizeToFit];
        
        
        UIView * lineView2 = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(sumtrLabel.frame) + 34 * hScale, MainScreenW, 2 * hScale)];
        lineView2.backgroundColor = GraylineColor;
        
        UIButton * dele = [UIButton buttonWithType:UIButtonTypeCustom];
        [dele setTitle:@"删除" forState:UIControlStateNormal];
        dele.frame = CGRectMake(455 * wScale, CGRectGetMaxY(lineView2.frame) + 14 * hScale, 138 * wScale, 48 * hScale);
        dele.titleLabel.font = [UIFont systemFontOfSize:26 * hScale];
        [dele setTitleColor:[UIColor colorWithRed:102 green:102 blue:102] forState:UIControlStateNormal];
        dele.layer.borderColor = [UIColor colorWithRed:102 green:102 blue:102].CGColor;
        dele.layer.borderWidth = 2 * wScale;
        
        [self addSubview:timeLabel];
        [self addSubview:itemTimeLabel];
        [self addSubview:lineView];
        [self addSubview:imageIcon];
        [self addSubview:numStrLabel];
        [self addSubview:numLabel];
        [self addSubview:numLabel2];
        [self addSubview:tipStrLabel];
        [self addSubview:tipLabel];
        [self addSubview:tipLabel2];
        [self addSubview:sumtrLabel];
        [self addSubview:sumLabel];
        [self addSubview:sumLabel2];
        [self addSubview:lineView2];
        [self addSubview:dele];
        

    }
    return self;
}
- (void)layoutSubviews:(LRXHistroyHelpItemModel *)cellModel
{
    self.itemTimeLabel.text = cellModel.req_end_time;
    

    NSString * url = [routeImageUrl stringByAppendingString:cellModel.profile_url];
    [self.imageIcon sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"de"]];
    
    self.thingCountlabel.text = [NSString stringWithFormat:@"%ld",cellModel.thingArray.count];
    self.thingTipLabel.text = cellModel.tips;
    self.thingSumlabel.text = cellModel.total_price;
}
@end
